<!-- HTML header for doxygen 1.11.0-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.11.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Doxygen: Including formulas</title>
<link rel="icon" href="doxygen.ico" type="image/x-icon" />
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="doxygen_manual.css" rel="stylesheet" type="text/css"/>
<link href="extra.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><a href="../index.html"><img alt="Logo" src="doxygen_logo.svg" height="35px"/></a></td>
  <td class="menu-item"><a href="index.html">Docs</a></td>
  <td class="menu-item"><a href="changelog.html">Changelog</a></td>
  <td class="menu-item"><a href="../helpers.html">Extensions</a></td>
  <td class="menu-item"><a href="../examples.html">Examples</a></td>
  <td class="menu-spacer">&#160;</td>
  <td class="menu-item" id="download">
      <img class="download-icon" src="../assets/download.svg" width="16px" height="16px" alt="Download doxygen"/>
      <a href="../download.html">Download</a>
  </td>
  <td class="menu-item" id="donate">
     <form action="https://www.paypal.com/cgi-bin/webscr" method="post" class="nav-item d-inline-flex px-1 mx-1">
       <input type="hidden" name="cmd" value="_donations" />
       <input type="hidden" value="doxygen@gmail.com" name="business" />
       <input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHosted" />
       <input type="hidden" name="lc" value="US" />
       <input type="hidden" name="tax" value="0" />
       <input type="hidden" name="item_name" value="Doxygen donation" />
       <input type="hidden" name="no_shipping" value="1" />
       <table class="donate">
         <tr>
           <td class="donate-button"><input type="image" width="74" height="21"
               src="https://www.paypal.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit"
               alt="Donate to Doxygen with PayPal!" /></td>
         </tr>
         <tr>
           <td class="currency"><select size="1" name="currency_code">
               <option selected="selected" value="EUR">&euro; (EUR)</option>
               <option value="USD">$ (USD)</option>
             </select></td>
         </tr>
       </table>
     </form>
   </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.11.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
     <div id="nav-tree-ads-carbon">
       <script async type="text/javascript" src="https://cdn.carbonads.com/carbon.js?serve=CK7DTK3M&placement=stacknl" id="_carbonads_js"></script>
     </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){initNavTree('formulas.html',''); initResizable(true); });
/* @license-end */
</script>
<div id="doc-content">
<div><div class="header">
  <div class="headertitle"><div class="title">Including formulas</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>Doxygen allows you to put <img class="formulaInl" alt="{\LaTeX}" src="form_0.png" width="34" height="13"/> formulas in the output (this works only for the HTML, <img class="formulaInl" alt="{\LaTeX}" src="form_0.png" width="34" height="13"/> and RTF output. To be able to include formulas (as images) in the HTML and RTF documentation, you will also need to have the following tools installed </p><ul>
<li>
<code>latex:</code> the <img class="formulaInl" alt="{\LaTeX}" src="form_0.png" width="34" height="13"/> compiler, needed to parse the formulas. To test I have used the teTeX 1.0 distribution. </li>
<li>
<code>dvips:</code> a tool to convert DVI files to PostScript files I have used version 5.92b from Radical Eye software for testing. </li>
<li>
<code>gs:</code> the GhostScript interpreter for converting PostScript files to bitmaps. I have used Aladdin GhostScript 8.0 for testing. </li>
</ul>
<p>For the HTML output there is also an alternative solution using <a href="https://www.mathjax.org">MathJax</a> which does not require the above tools. If you enable <a class="el" href="config.html#cfg_use_mathjax">USE_MATHJAX</a> in the configuration then the latex formulas will be copied to the HTML "as is" and a client side javascript will parse them and turn them into (interactive) images.</p>
<p>There are four ways to include formulas in the documentation. </p><ol>
<li>
<p class="startli">Using in-text formulas that appear in the running text. These formulas should be put between a pair of <a class="el" href="commands.html#cmdfdollar">\f$</a> commands, so </p><pre class="fragment">  The distance between \f$(x_1,y_1)\f$ and \f$(x_2,y_2)\f$ is 
  \f$\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\f$.
</pre><p> results in:</p>
<p class="endli">The distance between <img class="formulaInl" alt="$(x_1,y_1)$" src="form_1.png" width="39" height="14"/> and <img class="formulaInl" alt="$(x_2,y_2)$" src="form_2.png" width="39" height="14"/> is <img class="formulaInl" alt="$\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$" src="form_3.png" width="138" height="16"/>. <br  />
 </p>
</li>
<li>
<p class="startli">Using in-text formulas that appear in the running text, contrary to <a class="el" href="commands.html#cmdfdollar">\f$</a> it will not explicitly open the math mode in <img class="formulaInl" alt="{\LaTeX}" src="form_0.png" width="34" height="13"/> . These formulas should be put between <a class="el" href="commands.html#cmdfrndclose">\f(</a> and <a class="el" href="commands.html#cmdfrndopen">\f)</a> commands, so </p><pre class="fragment">  The LaTeX and Tex logos are: \f(\LaTeX \f) and \f(\TeX \f).
</pre><p> results in:</p>
<p class="endli">The LaTeX and Tex logos are: <img class="formulaInl" alt="{\LaTeX}" src="form_0.png" width="34" height="13"/> and <img class="formulaInl" alt="{\TeX}" src="form_4.png" width="25" height="13"/> . <br  />
 </p>
</li>
<li>
Unnumbered displayed formulas that are centered on a separate line. These formulas should be put between <a class="el" href="commands.html#cmdfbropen">\f[</a> and <a class="el" href="commands.html#cmdfbrclose">\f]</a> commands. An example: <pre class="fragment">  \f[
    |I_2|=\left| \int_{0}^T \psi(t) 
             \left\{ 
                u(a,t)-
                \int_{\gamma(t)}^a 
                \frac{d\theta}{k(\theta,t)}
                \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi
             \right\} dt
          \right|
  \f]
</pre> results in:          <p class="formulaDsp">
<img class="formulaDsp" alt="\[
    |I_2|=\left| \int_{0}^T \psi(t) 
             \left\{ 
                u(a,t)-
                \int_{\gamma(t)}^a 
                \frac{d\theta}{k(\theta,t)}
                \int_{a}^\theta c(\xi)u_t(\xi,t)\,d\xi
             \right\} dt
          \right|
  \]" src="form_5.png" width="329" height="39"/>
</p>
 </li>
<li>
Formulas or other latex elements that are not in a math environment can be specified using <a class="el" href="commands.html#cmdfcurlyopen">\f{environment}</a>, where <code>environment</code> is the name of the <img class="formulaInl" alt="{\LaTeX}" src="form_0.png" width="34" height="13"/> environment, the corresponding end command is <a class="el" href="commands.html#cmdfcurlyclose">\f}</a>. Here is an example for an equation array <pre class="fragment">   \f{eqnarray*}{
        g &amp;=&amp; \frac{Gm_2}{r^2} \\ 
          &amp;=&amp; \frac{(6.673 \times 10^{-11}\,\mbox{m}^3\,\mbox{kg}^{-1}\,
              \mbox{s}^{-2})(5.9736 \times 10^{24}\,\mbox{kg})}{(6371.01\,\mbox{km})^2} \\ 
          &amp;=&amp; 9.82066032\,\mbox{m/s}^2
   \f}
</pre> which results in:      <p class="formulaDsp">
<img class="formulaDsp" alt="\begin{eqnarray*}
        g &amp;=&amp; \frac{Gm_2}{r^2} \\ 
          &amp;=&amp; \frac{(6.673 \times 10^{-11}\,\mbox{m}^3\,\mbox{kg}^{-1}\,
              \mbox{s}^{-2})(5.9736 \times 10^{24}\,\mbox{kg})}{(6371.01\,\mbox{km})^2} \\ 
          &amp;=&amp; 9.82066032\,\mbox{m/s}^2
   \end{eqnarray*}" src="form_6.png" width="293" height="84"/>
</p>
 </li>
</ol>
<p>For the first and third commands one should make sure formulas contain valid commands in <img class="formulaInl" alt="{\LaTeX}" src="form_0.png" width="34" height="13"/> 's math-mode. The second command should valid text-mode commands that also work in math-mode when using <a class="el" href="config.html#cfg_use_mathjax">USE_MATHJAX</a>. For the fourth command the section should contain valid command for the specific environment.</p>
<dl class="section warning"><dt>Warning</dt><dd>Currently, doxygen is not very fault tolerant in recovering from typos in formulas. It may be necessary to remove the files <code>formula.repository</code> that are written to the html, rtf etc. directories to get rid of an incorrect formula as well as the <code>form_*</code> files.</dd></dl>
<p>To have the possibility to define your own <img class="formulaInl" alt="{\LaTeX}" src="form_0.png" width="34" height="13"/> commands, for e.g. formula building blocks or consistent writing of certain words, the configuration option <a class="el" href="config.html#cfg_formula_macrofile">FORMULA_MACROFILE</a> can be used. to supply a file with <img class="formulaInl" alt="{\LaTeX}" src="form_0.png" width="34" height="13"/> commands. This file can contain <img class="formulaInl" alt="{\LaTeX}" src="form_0.png" width="34" height="13"/> <code>\newcommand</code> and <code>\renewcommand</code> commands and they are included formulas (image version and MathJax version) as well as in the generated <img class="formulaInl" alt="{\LaTeX}" src="form_0.png" width="34" height="13"/> output (for PDF generation).<br  />
 The <code>\newcommand</code> (and <code>\renewcommand</code>) are restricted to a version without optional parameters so only the following types are supported: </p><div class="fragment"><div class="line">\newcommand{\cmd}{replacement}</div>
<div class="line">\newcommand{\cmd}[nr]{replacement}</div>
</div><!-- fragment --><p> e.g. </p><div class="fragment"><div class="line">\newcommand{\E}{\mathrm{E}}</div>
<div class="line">\newcommand{\ccSum}[3]{\sum_{#1}^{#2}{#3}}</div>
</div><!-- fragment --><p> 
Go to the <a href="tables.html">next</a> section or return to the
 <a href="index.html">index</a>.
 </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.11.0 </li>
  </ul>
</div>
</body>
</html>
